Also you need to install the following for code to work:
sudo apt-get install python-dev python-pip gcc
sudo apt-get install linux-headers-$(uname -r)
sudo pip install evdev
Note it worked without installing the header i.e 2nd satement
Then you can call it on start up via a cron such as:
@reboot python /home/pi/scripts/keyreboot.py &
Remember to give the file execution permisions